<?php
/**
 * View EVENTI - nuovo LaFabbrica.org
 * 
 * @author     luigi.pastore (gigi@la-fabbrica.org)
 * @created    17-mag-2011
 * @package    LaFabbrica
 * @copyright  Copyright (c) 2011 Luigi Pastore
 */
?>
<script type="text/javascript" src="/js/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="/js/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="/js/ckeditor/load-editor.js"></script>
<script type="text/javascript">
    //<![CDATA[
     
    $(document).ready(function()
    {
        $("#event_title").rules("add", {
            required: true,
            messages: {
                required: "<?php echo ERR_EMPTY ?>"
            }
        });

        $("#event_desc").rules("add", {
            required: true,
            messages: {
                required: "<?php echo ERR_EMPTY ?>"
            }
        });

        $( '#event_desc' ).ckeditor(function(){}, ckeditorConf );
        
        // Risolve un bug d'integrazione tra jQuery e CKeditor
	$("#salva").click(function(){
            CKEDITOR.instances.event_desc.updateElement();

            validator.form();
            return validator.element( "#event_desc" );
	});

    });


    //]]>
</script>
<div id="content">
    <div id="summary" class="events">
	<div class="head">
	    <h2>Eventi / Rassegne</h2>
	</div>
	<div class="body">Un'Evento/Rassegna &egrave; un insieme di Live (Es: Tour, Rassegne, ecc...)</div>
    </div>
    <form>
	<ul>
	    <li class="paging-context ">
		<table class="pgStyle1 circle2" cellspacing="0">
		    <tr>
			<td class="c selected">
			    <var>1</var>
			</td>
			<td class="t selected">
			    <b id="pagecircle1">Info Evento/Rassegna</b>
			</td>
			<td class="c">
			    <var>2</var>
			</td>
			<td class="t">
			    <b id="pagecircle2">Scegli Live</b>
			</td>
			<td class="c">
			    <var>3</var>
			</td>
			<td class="t">
			    <b id="pagecircle2">Conferma</b>
			</td>	
			<td class="c">
			    <var>4</var>
			</td>
			<td class="t">
			    <b id="pagecircle2">Fine!</b>
			</td>			
		    </tr>
		</table>
	    </li>
	</ul>
    </form>
    <div class="help">
	<h2>Info Evento:</h2>
	<br/>
	<div>Inserisci i dettagli dell'evento</div>
    </div>

    <form id="formEvent" name="formEvent" class="fab" method="post" action="/admin/eventi/info/id/<?php echo $this->event_id ?>">	    
	<ul>
	    <li id="errorLi" style="<?php echo $this->errorMsg ? '' : 'display:none' ?>">
		<h3 id="errorMsgLbl">Si &egrave; verificato un problema durante l'invio del modulo.</h3>
		<p id="errorMsg">
		Di seguito trovi evidenziati gli errori riscontrati.
		</p>
	    </li>

	    <li class="<?php echo $this->errorMsg['event_title'] ? 'error' : '' ?>">
		<label class="desc <?php echo $this->errorMsg['event_title'] ? 'error' : '' ?>">Titolo<span class="req">*</span></label>
		<div>
		    <span>
			<input id="event_title" name="event_title" class="field text medium" type="text" maxlength="255" value="<?php echo $this->data['event_title'] ?>" /> 
		    </span>
		</div>
		<p class="error" style="<?php echo $this->errorMsg['event_title'] ? 'display:block' : '' ?>"><?php echo $this->errorMsg['event_title'] ?></p>
	    </li>

	    <li>
		<label class="desc">Tipo</label>
		<div>
		    <?php
		    foreach( $this->event_types AS $event_type ):
			?>
			<span class="input">
			    <input id="event_type<?php echo $event_type['event_type_id'] ?>" name="event_type" class="field radio" type="radio" value="<?php echo $event_type['event_type_id'] ?>" checked="checked" />
			    <label class="choice" for="event_type<?php echo $event_type['event_type_id'] ?>"><?php echo $event_type['event_type_name'] ?></label>
			</span>			
			<?php
		    endforeach;
		    ?>
		</div>
		<p id="instruct" class="instruct">
		    <small>
		    <?php
		    foreach( $this->event_types AS $event_type ):
			?>
			<strong><?php echo $event_type['event_type_name'] ?>:</strong> <?php echo $event_type['event_type_desc'] ?><br />
			<?php
		    endforeach;
		    ?>			
		    </small>
		</p>		
	    </li>	    
	    
	    <li class="<?php echo $this->errorMsg['event_desc'] ? 'error' : '' ?>">
		<label class="desc <?php echo $this->errorMsg['event_desc'] ? 'error' : '' ?>">Descrizione<span class="req">*</span></label>
		<div>
		    <span>
			<textarea id="event_desc" name="event_desc" rows="10" cols="50"><?php echo $this->data['event_desc'] ?></textarea>
		    </span>
		</div>
		<p class="error" style="<?php echo $this->errorMsg['event_desc'] ? 'display:block' : '' ?>"><?php echo $this->errorMsg['event_desc'] ?></p>
	    </li>	    
	    
	    <li class="section">
		<h3>Altre Informazioni</h3>
	    </li>    
	    <li>
		<label class="desc">Pubblica?</label>
		<div>
		    <span class="input">
			<input id="event_published1" name="event_published" class="field radio" type="radio" value="1" checked="checked" />
			<label class="choice" for="event_published1">S&iacute;</label>
		    </span>
			    
		    <span class="input">
			<input id="event_published0" name="event_published" class="field radio" type="radio" value="0" />
			<label class="choice" for="event_published0">No</label>
		    </span>
		</div>
		<p id="instruct" class="instruct">
		    <small>Scegli se rendere pubblico l'elemento.</small>
		</p>	
	    </li>
	    <li class="<?php echo $this->errorMsg['event_notes'] ? 'error' : '' ?>">
		<label class="desc <?php echo $this->errorMsg['event_notes'] ? 'error' : '' ?>">Note</label>
		<div>
		    <span>
			<textarea id="event_notes" class="field textarea small" name="event_notes" rows="3" cols="100"><?php echo htmlentities( $this->data['event_notes'] ) ?></textarea>
		    </span>
		</div>
		<p class="error" style="<?php echo $this->errorMsg['event_notes'] ? 'display:block' : '' ?>"><?php echo $this->errorMsg['event_notes'] ?></p>
		<p id="instruct" class="instruct">
		    <small>Inserisci eventuali note.
			<br/>Queste non verranno pubblicate.</small>
		</p>
	    </li>    
	</ul>
	<input type="hidden" name="conferma" id="conferma" value="conferma" />
    <br style="clear: both" />
</div>
<div id="formButtons">
    <button id="salva" type="submit" name="salva" value="salva" class="button positive">
	<img src="/images/admin/tick.png" alt="" />Continua
    </button>
    <button id="annulla" name="annulla" value="annulla" class="button negative">
	<img src="/images/admin/cross.png" alt="" />Annulla
    </button>
</div>
</form>
